package com.wuqing.dubbo02.service;

import com.wuqing.StudyService;
import com.wuqing.bean.Constant;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.rpc.RpcContext;

import java.util.Map;

/**
 * @author wuqing
 * @date 2020/8/6
 */
@Service(version = "${demo.service.version}", registry = "${dubbo.registry.id}")
public class StudyServiceImpl implements StudyService {

    @Override
    public String study(String name) {

        Map<String, String> attachments = RpcContext.getContext().getAttachments();
        System.out.println(attachments);

        String attachmentIp = RpcContext.getContext().getAttachment(Constant.ip);
        return "Dubbo02 好好学习 ~~~" + name + "，调用ip是" + attachmentIp;
    }
}